function select(id){
  $(".recharge-body-item").removeClass("recharge-body-item-selected");
  $("#btn"+id).addClass("recharge-body-item-selected");
  $("#serviceId").val(id);
};
//下单
function submitorder(){
    var  obj ;
    obj={};
    var serviceType= $("#serviceType").val();
    obj=$("#recharge_frm_main").serializeObject();


    // var teacherid = server.getQueryString("teachid");

    // obj.teacherId=teacherid;
    var item= {};
    obj.itemList=[];

    if(serviceType=="3") {
        item = {
            itemType: obj.serviceType,
            itemName: obj.description,
            description: obj.description,
            birthId: obj.birthid,
            openQuestions: (obj.publicask && obj.publicask == "on") ? 1 : 0
        };
    }else if(serviceType=="1")  {
        item = {
            itemType: obj.serviceType,
            itemId:obj.service

        };
    }else if(serviceType=="2")  {
        item = {
            itemType: obj.serviceType,
            itemId:obj.serviceId,
            birthId: obj.birthid
        };
    }else if(serviceType=="5")  {
        item = {
            itemType: obj.serviceType,
            itemId:obj.serviceId

        };
    }else if(serviceType=="4")  {
    item = {
        itemType: obj.serviceType,
        itemId:obj.serviceId

    };
}
    //  itemList.push(item);
    obj.itemList.push(item);
    console.log(obj)
    server.req("wechat/order/createOrder",obj,function (e){
        console.log(e);
        if(e.code==0){
            server.setCache("orderInfo",JSON.stringify(e.data));
            server.loadindex('page/order/submitorder/submitorder',"",true);
        }else{
            pop_up(e.msg)
        }
    },null,"POST")

};
server.req('wechat/recharge/all',{},function (res) {
    console.log(res);
    if(res.code==0){
        server.loadData(".recharge",res);
        if(res.data.length>0){
            $("#btn1").addClass("recharge-body-item-selected");
        }
    }
})